import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PersonGroupVO, PersonGroupForm, PersonGroupQuery } from '@/api/device/personGroup/types';

/**
 * 查询通行人员分组列表
 * @param query
 * @returns {*}
 */

export const listPersonGroup = (query?: PersonGroupQuery): AxiosPromise<PersonGroupVO[]> => {
  return request({
    url: '/device/personGroup/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询通行人员分组详细
 * @param groupId
 */
export const getPersonGroup = (groupId: string | number): AxiosPromise<PersonGroupVO> => {
  return request({
    url: '/device/personGroup/' + groupId,
    method: 'get'
  });
};

/**
 * 新增通行人员分组
 * @param data
 */
export const addPersonGroup = (data: PersonGroupForm) => {
  return request({
    url: '/device/personGroup',
    method: 'post',
    data: data
  });
};

/**
 * 修改通行人员分组
 * @param data
 */
export const updatePersonGroup = (data: PersonGroupForm) => {
  return request({
    url: '/device/personGroup',
    method: 'put',
    data: data
  });
};

/**
 * 删除通行人员分组
 * @param groupId
 */
export const delPersonGroup = (groupId: string | number | Array<string | number>) => {
  return request({
    url: '/device/personGroup/' + groupId,
    method: 'delete'
  });
};
